using UnityEngine;
using System.Collections;

public class BulletScript : MonoBehaviour {
	
	public float VELOCITY;
	public int DAMAGE;
	private float lifetime = 6.0f;

	// Use this for initialization
	void Start () {
		lifetime = 6.0f;
		DAMAGE = 100;
	}
	
	public void set_direction(Vector2 v_bullet)
	{
		rigidbody.velocity = new Vector3(12 * v_bullet.x, 0, 12 * v_bullet.y);
	}
	
	// Update is called once per frame
	void Update () {
		//rigidbody.velocity = Vector3.forward * VELOCITY;
		lifetime -= Time.deltaTime;
		if (lifetime <=0) 
			PoolManager.Pools["PowerUps"].Despawn(transform);
				
	}
	
	void OnCollisionEnter(Collision col)
	{
		PoolManager.Pools["PowerUps"].Despawn(transform);
					
	}
	void OnDespawn()
	{
		lifetime = 6.0f;
		DAMAGE = 100;
	}
	
}
